/*
 NSDataAdditions.h
 MailDelivery
 
 Created by Dante Palacios on 26/08/09.
 Copyright 2009 Dante Palacios. All rights reserved.
 */

/*!
 @header NSDataAdditions.h
 @discussion This header contains some utility methods for the framework. Some of these methods may disappear or change their names without prior notice. For more information, contact palacios.dante\@gmail.com.
 */

#import <Foundation/Foundation.h>
#import <Security/Security.h>

/*!
 @category NSData(Base64Additions)
 @abstract .
 */

@interface NSData(Base64Additions)

/*!
 @method encodeBase64
 @abstract As in @link encodeBase64WithNewlines: encodeBase64WithNewlines: @/link, passing NO as option. Most of the times we do not need new lines.
 */

- (NSString *)encodeBase64;

/*!
 @method encodeBase64WithNewlines:
 @abstract The framework use this method to encode attachments only because the message source is a litle more readable, but the resulting string still needs to end with CRLF line breaks. Most of the SMTP servers ignore things like this, but some others are very strict about it.
 @param encodeWithNewlines
 ...
 */

- (NSString *)encodeBase64WithNewlines:(BOOL)encodeWithNewlines;

@end

/*!
 @category NSData(CMSAddtions)
 @abstract Used to encode, sign, and/or encrypt data in the Cryptographic Message Syntax. Not used by the framework but I decided to donnot remove these methods from this header because... well you know, we may need them sometime.
 */

@interface NSData(CMSAddtions)

/*!
 @method encodedCMSDataUsingCertificateRef:SMIMESigned:SMIMEEncripted:
 @abstract encode data for use with SMIME.
 @param certificateRef
 the <tt>SecCertificateRef</tt> to use for encoding the data. See @link //maildelivery_ref/c/func/GetCertificateRefForEmail GetCertificateRefForEmail @/link.
 @param SMIMESigned
 should the data be SMIME signed.
 @param SMIMEEncripted
 should the data be SMIME encrypted.
 @result CMS encrypted data.
 */

- (NSData *)encodedCMSDataUsingCertificateRef:(SecCertificateRef)certificateRef SMIMESigned:(BOOL)SMIMESigned SMIMEEncripted:(BOOL)SMIMEEncripted;

/*!
 @method encodedCMSDataUsingCertificateRef:
 @abstract As in @link encodedCMSDataUsingCertificateRef:SMIMESigned:SMIMEEncripted: encodedCMSDataUsingCertificateRef:SMIMESigned:SMIMEEncripted: @/link, passing YES to both options.
 */

- (NSData *)encodedCMSDataUsingCertificateRef:(SecCertificateRef)certificateRef;

/*!
 @method decodedCMSData
 @abstract decode CMS data.
 */

- (NSData *)decodedCMSData;

@end

@interface NSData(MailDeliveryQuotedPrintableAdditions)

- (NSData *)encodeQuotedPrintableWithLineLength:(NSInteger)lineLength inHeader:(BOOL)flag;

@end